# -*- coding: utf-8 -*-

import serial.tools.list_ports


# 遍历所有COM口，如果存在CH340描述名称，则输出COM口名称
for port in serial.tools.list_ports.comports():
    des = port.description
    if "340" in des:
        print(port.device)
